﻿@{
    Layout = null;
}
@model List<IGrouping<int, Netnr.Domain.SysTableConfig>>

<input type="hidden" name="hidtablename" value="@TempData["tablename"]" />
<input type="hidden" name="hidtableindex" value="@TempData["index"]" />

<!--模态 表单-->
<div class="modal fade modalautoheight" id="fv_modal_@TempData["index"]" role="dialog" data-backdrop="static">
    <div class='modal-dialog @TempData["modalsize"]'>
        <div class="modal-content">

            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span>&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="fv_title_@TempData["index"]">
                    <i class="fa fa-plus blue"></i><span>表单标题</span><em>✶ 为必填</em>
                </h4>
            </div>

            <div class="modal-body">
                <form class="form-horizontal formui" id="fv_form_@TempData["index"]">
                    <div class="row">

                        @if (Model.Count > 1)
                        {
                            var paneltitle = TempData["paneltitle"] as List<string>;

                            <ul class='nav nav-tabs' role='tablist' id='fv_tabs_@TempData["index"]'>
                                @foreach (var mo in Model)
                                {
                                    var pt = "面板" + mo.Key;
                                    if (mo.Key <= paneltitle.Count && !string.IsNullOrWhiteSpace(paneltitle[mo.Key - 1]))
                                    {
                                        pt = paneltitle[mo.Key - 1];
                                    }

                                    <li class='@(mo.Key == 1 ? "active" : "")'>
                                        <a href='#fv_panel_@mo.Key' data-toggle='tab'>@pt</a>
                                    </li>
                                }
                            </ul>
                            <div class='tab-content' id='fv_tc_ @TempData["index"]'>
                                @foreach (var mo in Model)
                                {
                                    <div class='modalscroll tab-pane @(mo.Key == 1 ? "active" : "")' id='fv_panel_@mo.Key'>
                                        @foreach (var item in mo)
                                        {
                                            <div class='col-md-@Math.BigMul(6,item.FormSpan.Value) col-sm-6 @(item.FormHide>=1?"hidden":"")'>
                                                <div class="form-group">
                                                    <label class='control-label @(item.FormRequired==1?"required":"")'>@item.ColTitle</label>
                                                    <div>
                                                        @if ("checkbox".Contains(item.FormType))
                                                        {
                                                            <label class="checkbox">
                                                                <input type="checkbox" @(item.FormValue == "1" ? "checked" : "") value="1" id="@item.ColField" name="@item.ColField" data-type="@item.FormType" data-query="@item.ColQuery" data-url="@item.FormUrl" placeholder="@item.FormPlaceholder" />
                                                                @item.FormText
                                                            </label>
                                                        }
                                                        else if ("datetime".Contains(item.FormType))
                                                        {
                                                            <input type='text' id="@item.ColField" name="@item.ColField" class="form-control" value="@item.FormValue" data-type="@item.FormType" data-query="@item.ColQuery" data-url="@item.FormUrl" placeholder="@item.FormPlaceholder" />
                                                        }
                                                        else if ("modal".Contains(item.FormType))
                                                        {
                                                            <input type='text' id="@item.ColField" name="@item.ColField" class="form-control" value="@item.FormValue" data-type="@item.FormType" data-query="@item.ColQuery" data-url="@item.FormUrl" placeholder="@item.FormPlaceholder" />
                                                            <i class="fa fa-search form-control-feedback"></i>
                                                        }
                                                        else if ("textarea".Equals(item.FormType))
                                                        {
                                                            <textarea id="@item.ColField" name="@item.ColField" class="form-control area-height" data-type="@item.FormType" data-query="@item.ColQuery" data-url="@item.FormUrl" placeholder="@item.FormPlaceholder">@item.FormValue</textarea>
                                                        }
                                                        else if ("password".Equals(item.FormType))
                                                        {
                                                            <input type='password' id="@item.ColField" name="@item.ColField" class="form-control" value="@item.FormValue" data-type="@item.FormType" data-query="@item.ColQuery" data-url="@item.FormUrl" placeholder="@item.FormPlaceholder" />
                                                        }
                                                        else if ("file".Equals(item.FormType))
                                                        {
                                                            <input type='file' id="@item.ColField" class="form-control" data-type="@item.FormType" data-query="@item.ColQuery" data-url="@item.FormUrl" />
                                                            <input type="hidden" id="hid_@item.ColField" name="@item.ColField" value="@item.FormValue" />
                                                            if (!string.IsNullOrWhiteSpace(item.FormPlaceholder))
                                                            {
                                                                <p class="help-block">@item.FormPlaceholder</p>
                                                            }
                                                        }
                                                        else
                                                        {
                                                            <input type='text' id="@item.ColField" name="@item.ColField" class="form-control" value="@item.FormValue" data-type="@item.FormType" data-query="@item.ColQuery" data-url="@item.FormUrl" placeholder="@item.FormPlaceholder" />
                                                        }
                                                    </div>
                                                </div>
                                            </div>
                                        }
                                    </div>
                                }
                            </div>
                        }
                        else
                        {
                            foreach (var mo in Model)
                            {
                                foreach (var item in mo)
                                {
                                    <div class='col-md-@Math.BigMul(6,item.FormSpan.Value) col-sm-6 @(item.FormHide>=1?"hidden":"")'>
                                        <div class="form-group">
                                            <label class='control-label @(item.FormRequired==1?"required":"")'>@item.ColTitle</label>
                                            <div>
                                                @if ("checkbox".Contains(item.FormType))
                                                {
                                                    <label class="checkbox">
                                                        <input type="checkbox" @(item.FormValue == "1" ? "checked" : "") value="1" id="@item.ColField" name="@item.ColField" data-type="@item.FormType" data-query="@item.ColQuery" data-url="@item.FormUrl" placeholder="@item.FormPlaceholder" />
                                                        @item.FormText
                                                    </label>
                                                }
                                                else if ("datetime".Contains(item.FormType))
                                                {
                                                    <input type='text' id="@item.ColField" name="@item.ColField" class="form-control" value="@item.FormValue" data-type="@item.FormType" data-query="@item.ColQuery" data-url="@item.FormUrl" placeholder="@item.FormPlaceholder" />
                                                }
                                                else if ("modal".Contains(item.FormType))
                                                {
                                                    <input type='text' id="@item.ColField" name="@item.ColField" class="form-control" value="@item.FormValue" data-type="@item.FormType" data-query="@item.ColQuery" data-url="@item.FormUrl" placeholder="@item.FormPlaceholder" />
                                                    <i class="fa fa-search form-control-feedback"></i>
                                                }
                                                else if ("textarea".Equals(item.FormType))
                                                {
                                                    <textarea id="@item.ColField" name="@item.ColField" class="form-control area-height" data-type="@item.FormType" data-query="@item.ColQuery" data-url="@item.FormUrl" placeholder="@item.FormPlaceholder">@item.FormValue</textarea>
                                                }
                                                else if ("password".Equals(item.FormType))
                                                {
                                                    <input type='password' id="@item.ColField" name="@item.ColField" class="form-control" value="@item.FormValue" data-type="@item.FormType" data-query="@item.ColQuery" data-url="@item.FormUrl" placeholder="@item.FormPlaceholder" />
                                                }
                                                else if ("file".Equals(item.FormType))
                                                {
                                                    <input type='file' id="@item.ColField" class="form-control" data-type="@item.FormType" data-query="@item.ColQuery" data-url="@item.FormUrl" />
                                                    <input type="hidden" id="hid_@item.ColField" name="@item.ColField" value="@item.FormValue" />
                                                    if (!string.IsNullOrWhiteSpace(item.FormPlaceholder))
                                                    {
                                                        <p class="help-block">@item.FormPlaceholder</p>
                                                    }
                                                }
                                                else
                                                {
                                                    <input type='text' id="@item.ColField" name="@item.ColField" class="form-control" value="@item.FormValue" data-type="@item.FormType" data-query="@item.ColQuery" data-url="@item.FormUrl" placeholder="@item.FormPlaceholder" />
                                                }
                                            </div>
                                        </div>
                                    </div>
                                }
                            }
                        }
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button id="fv_save_@TempData["index"]" type="button" class="btn btn-primary"><span class="fa fa-save"></span>&nbsp;保存</button>
            </div>
        </div>
    </div>
</div>